﻿using System;
using System.Collections.Generic;
using Acaweb.Data.Contracts;
using Acaweb.Model.Entities;
using Acaweb.Model.Entities.DatosCompuestos;
using Spring.Transaction.Interceptor;

namespace Acaweb.Data.Dao.NHibernate
{
    public class PensumDao : HibernateDao<Pensum, PensumPk>, IPensumDao
    {
        [Transaction(ReadOnly = true)]
        public IList<Pensum> GetAll()
        {
            return GetAll<Pensum>();
        }

        public IList<Pensum> GetByPlanEstudio(int CodigoPlan)
        {
            return this.Session.QueryOver<Pensum>().Where(t => t.PensumPk.CodigoPlan == CodigoPlan).List();
        }

        public IList<Pensum> GetByMateria(int CodigoMateria)
        {
            return this.Session.QueryOver<Pensum>().Where(t => t.PensumPk.CodigoMateria == CodigoMateria).List();
        }

        public IList<Pensum> GetByPlanEstudio(int CodigoPlan, int CodigoPensum)
        {
            return this.Session.QueryOver<Pensum>().Where(t => t.PensumPk.CodigoPlan == CodigoPlan && t.PensumPk.CodigoPensum == CodigoPensum).List();
        }

        public IList<Pensum> GetByCodigoPensum(int CodigoPensum, int CodigoPlan)
        {
            return this.Session.QueryOver<Pensum>().Where(t => t.PensumPk.CodigoPensum == CodigoPensum && t.PensumPk.CodigoPlan == CodigoPlan).List();
        }
    }
}